home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / comms / other / kewl / kewlraw / kewlraw.amos / kewlraw.amosSourceCode < prev   
AMOS Source Code  |  1999-04-21  |  6KB  |  208 lines

  1. ' KewlRAW 1.6 (25.5.98) ï¿½1998 Steve Clack of Liquid Software Design/NSA Design 
  2.  
  3. ' Conditions of release: 
  4. ' Credit me & LSA/NSA in future releases/offsprings of this source.
  5. ' Don't be lame and just recompile this with your name on it ;). 
  6.  
  7. ' Why release the source code? 
  8. ' May help some new up-and-coming developer! Perhaps take KewlRAW
  9. ' to a new level? :) This is the last LSD release of this door.
  10.  
  11. ' Requirements:
  12. ' AMOS Pro, KewlDoors by Niki Murkett. 
  13.  
  14. ' I'm not exactly proud of this, so don't judge all my source by it. :)  
  15.  
  16. NODE=Val(Right$(Command Line$,1))
  17. If True= Extension_17_0006(NODE) Then Goto LEAVE
  18. Set Input 10,-1 : On Error Goto ERR
  19.  
  20. If Len(Command Line$)>2 : _DIR$=Left$(Command Line$,Len(Command Line$)-2) : Else : _DIR$="Sys:" : End If 
  21.  
  22. VER$="$VER: KewlRAW 1.6 (25.5.98) ï¿½1998 Steve Clack (LSD/NSA)"
  23.  
  24. Dim _RT_FILELIST$(100)
  25. CLR$=Chr$(12) : CR$=Chr$(13) : ESC$=Chr$(27) : PS$="%Z"
  26. Global _RT_FILELIST$(),_FL,_DIR$,NODE,CR$,ESC$,PS$
  27.  
  28. BUTTONS$="Retry|Continue|Pick new|Quit"
  29. KEWLRAW$="Doors:KewlRAW/"
  30.  
  31. Gosub _EMULATE_PRO
  32.  
  33. If _WORKED=False
  34.    N= Extension_17_002E(CR$+"Unable to find MAX's BBS 68000 memory structure!"+CR$+PS$)
  35.    Goto LEAVE
  36. End If 
  37.  
  38. Trap Lib Open 1,"reqtools.library",37 : If Errtrap>0 : N= Extension_17_002E(CR$+ESC$+"[31mUnable to open reqtools.library V37+"+CR$+PS$) : Goto LEAVE : End If 
  39. X=1
  40.  
  41. If True= Extension_17_02A8(KEWLRAW$+"Security.text") Then Goto LEAVE
  42. KEYPRESS= Extension_17_003E 
  43. If Extension_17_004E <0 Then Goto LEAVE
  44.  
  45. Dir$=_DIR$
  46.  
  47. MANLOO:
  48. _MORE=False
  49. N= Extension_17_02A8(KEWLRAW$+"Selecting.text")
  50.  
  51. If True= Extension_17_00C4 : Goto LEAVE : End If 
  52.  
  53. RT_MULTIFILEREQ["Select files (hold shift)"]
  54.  
  55. If _FL=0
  56.    N= Extension_17_02A8(KEWLRAW$+"Nofiles.text")
  57.    N= Extension_17_002E(PS$)
  58.    Goto LEAVE
  59. End If 
  60.  
  61. RT_EZREQ["Download more files after this download?","Yes|No"] : If Param=1 : _MORE=True : End If 
  62.  
  63. For A=1 To _FL
  64.    If Exist("T"+(Str$(NODE)-" ")+":"+_RT_FILELIST$(A))
  65.       If True= Extension_17_002E(CLR$+ESC$+"[37m") : Goto LEAVE : End If 
  66.       
  67.       If Instr(_RT_FILELIST$(A)," ") and Extension_18_0248("T"+(Str$(NODE)-" ")+":")=2
  68.          Rename "T"+(Str$(NODE)-" ")+":"+_RT_FILELIST$(A) To "T"+(Str$(NODE)-" ")+":"+_RT_FILELIST$(A)-" "
  69.          _CHANGE=True
  70.       Else 
  71.          _CHANGE=False
  72.       End If 
  73.       
  74.       DLSB4= Extension_17_05E0 : RATIO= Extension_17_051C 
  75.       Loke _SEGLIST+$13D36,0
  76.       N= Extension_17_00F2(124,0,"T"+(Str$(NODE)-" ")+":"+_RT_FILELIST$(A)-" ")
  77.       Loke _SEGLIST+$13D36,RATIO
  78.       
  79.       If _CHANGE=True
  80.          Rename "T"+(Str$(NODE)-" ")+":"+_RT_FILELIST$(A)-" " To "T"+(Str$(NODE)-" ")+":"+_RT_FILELIST$(A)
  81.       End If 
  82.       
  83.       N= Extension_17_002E("Done!")
  84.       If True= Extension_17_00C4 : Goto LEAVE : End If 
  85.       
  86.       If Extension_17_05E0 =DLSB4
  87.          N= Extension_17_0064(Chr$(7))
  88.          RT_EZREQ["File download failed or aborted, what now?",BUTTONS$] : PARM=Param
  89.          If PARM=0 : Goto LEAVE : End If 
  90.          If PARM=1 : A=A-1 : End If 
  91.          If PARM=3 : Goto MANLOO : End If 
  92.       End If 
  93.    Else 
  94.       N= Extension_17_0064(Chr$(7))
  95.       RT_EZREQ['"'+_RT_FILELIST$(A)+'" not found!',BUTTONS$] : PARM=Param
  96.       If PARM=0 : Goto LEAVE : End If 
  97.       If PARM=1 : A=A-1 : End If 
  98.       If PARM=3 : Goto MANLOO : End If 
  99.    End If 
  100. Next A
  101.  
  102. N= Extension_17_0064(Chr$(7))
  103. If _MORE=True : Goto MANLOO : End If 
  104.  
  105. ' Leave & cleanup correctly. 
  106.  
  107. LEAVE:
  108. Exec("Assign T"+(Str$(NODE)-" ")+": REMOVE")
  109. If X=1 Then Lib Close 1
  110. End 
  111.  
  112. ' This bit of code ï¿½ Niki Murkett. 
  113.  
  114. _EMULATE_PRO:
  115. P$="DoorControl"+Str$(NODE)-" "+Chr$(0)
  116. Areg(1)=Varptr(P$)
  117. PRT=Execall(-$186)
  118. If PRT=0 Then Return 
  119. PRT2=Leek(PRT+10)-$13582
  120. ' prt=Pointer to port name string! 
  121. _SEGLIST=PRT2
  122. _CONFIG=Leek(_SEGLIST+$12B66)
  123. _WORKED=True
  124. Return 
  125.  
  126. ERR:
  127. N= Extension_17_002E(CR$+ESC$+"[31mSerious error #"+(Str$(Errn)-" ")+" has occured!"+CR$)
  128. N= Extension_17_002E("Internal error, contact sysop."+CR$+PS$)
  129. Resume LEAVE
  130.  
  131. Procedure RT_MULTIFILEREQ[TITLE$]
  132.    Reserve As Data 666,64
  133.    ST666=Start(666)
  134.    
  135.    Loke ST666,$80000000+40
  136.    Loke ST666+4,1+16
  137.    
  138.    Reserve As Data 667,200
  139.    ST667=Start(667)
  140.    Loke ST667,$80000000+50
  141.    Loke ST667+4,ST667+20
  142.    
  143.    Poke$ ST667+20,_DIR$
  144.    
  145.    BUFFER$=String$(Chr$(0),109)
  146.    
  147.    TITLE$=TITLE$+Chr$(0)
  148.    Dreg(0)=0
  149.    Areg(0)=0
  150.    FRPOINTER=Lib Call(1,-30)
  151.    
  152.    If FRPOINTER<>0
  153.       Areg(1)=FRPOINTER
  154.       Areg(0)=ST667
  155.       VOID=Lib Call(1,-48)
  156.       Areg(1)=FRPOINTER
  157.       Areg(2)=Varptr(BUFFER$)
  158.       Areg(3)=Varptr(TITLE$)
  159.       Areg(0)=ST666
  160.       B=Lib Call(1,-54)
  161.       FILEBASE=B
  162.       P=Leek(FRPOINTER+16)
  163.       B$=Peek$(P,100,Chr$(0))
  164.       Areg(1)=FRPOINTER
  165.       B=Lib Call(1,-36)
  166.    Else 
  167.       N= Extension_17_002E(CR$+ESC$+"[31mRequester allocation failed!"+CR$+PS$)
  168.       Lib Close 1 : End 
  169.    End If 
  170.    
  171.    BASEPTR=FILEBASE
  172.    
  173.    If B$<>"" and Right$(B$,1)<>":"
  174.       B$=B$+"/"
  175.    End If 
  176.    
  177.    Dir$=B$ : FIN=False : _FL=1
  178.    
  179.    If FILEBASE=0 Then Goto _ENDRT
  180.    
  181.    Repeat 
  182.       PTR=Leek(FILEBASE)
  183.       If FIN=False Then _RT_FILELIST$(_FL)=Peek$(Leek(FILEBASE+8),70,Chr$(0)) : Inc _FL
  184.       FILEBASE=PTR
  185.       If PTR=0 Then FIN=True
  186.    Until FIN=True or _FL>99
  187.    
  188.    Exec('Assign T'+(Str$(NODE)-' ')+': "'+B$+'"')
  189.    
  190.    Areg(0)=BASEPTR
  191.    If BASEPTR>2 Then VOID=Lib Call(1,-60)
  192.    
  193.    _ENDRT:
  194.    Dec _FL
  195.    Erase 666
  196.    Erase 667
  197. End Proc
  198.  
  199. Procedure RT_EZREQ[HAIL$,BUTTON$]
  200.    HAIL$=HAIL$+Chr$(0)
  201.    BUTTON$=BUTTON$+Chr$(0)
  202.    Areg(1)=Varptr(HAIL$)
  203.    Areg(2)=Varptr(BUTTON$)
  204.    Areg(3)=0
  205.    Areg(4)=0
  206.    Areg(0)=0
  207.    A=Lib Call(1,-66)
  208. End Proc[A]